package com.example.springbootdemo.app.service.impl;

import com.example.springbootdemo.api.DTO.GetScoreDTO;
import com.example.springbootdemo.app.service.ScService;
import com.example.springbootdemo.domin.VO.getScoreVO;
import com.example.springbootdemo.domin.entity.Sc;
import com.example.springbootdemo.infra.mapper.ScMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ScServiceImpl implements ScService {
    @Autowired
    private ScMapper scMapper;

    @Override
    public String getScoreByTnoOrCno(GetScoreDTO getScoreDTO) {
        return scMapper.getScoreByCnoAndTno(getScoreDTO);
    }

    @Override
    public List<getScoreVO> getScore(Integer sno) {
        //根据学生查询课程成绩
        List<getScoreVO> cno = scMapper.getCno(sno);
        return cno;
    }

    @Override
    public void updateScore(Sc sc) {
        scMapper.updateScore(sc);
    }

    @Override
    public void addScore(Sc sc) {
        scMapper.addScore(sc);
    }

    @Override
    public void deleteScore(GetScoreDTO getScoreDTO) {
        scMapper.deleteScore(getScoreDTO);
    }

    @Override
    public List<Sc> getAll() {
        return scMapper.getAll();
    }

    @Override
    public void delete(Integer scoreno) {
        scMapper.delete(scoreno);
    }

    @Override
    public Sc getById(Integer scoreno) {
        return scMapper.getById(scoreno);
    }

}
